serj = []
for i in range(2, 1000):
    f =1
    for j in range(2,i//2):
        if i%j==0:
            f=0
            break
    if f:
        serj.append(i)

num = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
ch = input().replace('9', '&').replace('8', '&').replace('7', '&').replace('6', '&')\
     .replace('5', '&').replace('4', '&').replace('3', '&').replace('2', '&')\
     .replace('1', '&').replace('0', '&')
if not(len(ch.split())==3) or "&" in ch:
    print('Wrong input')

else:
    d = ch.split()
    new = ''
    for i in d:
        new += str(num.index(i))
    grate_maks = int(new)

    razn = []
    for i in serj:
        razn.append([abs(grate_maks - i), i])

    print(sorted(razn)[0][1])